/*

Copyright 2007 Renaun Erickson (http://renaun.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ignore
*/
package asfslib.api.familytree.v1
{

import mx.collections.ArrayCollection;

/**
 * 
 * 
 */
public class Person extends PersonSummaryBase
{

    //--------------------------------------------------------------------------
    //
    //  Constants
    //
    //--------------------------------------------------------------------------
    
    public static function parseXML(xml:XML):Person
    {
    	if (xml.namespace("") != undefined) 
		{
		    default xml namespace = xml.namespace("");
		} 
		
		var person:Person = new Person();
		person.id = xml.@id;
		//person.modified = xml.@modified;
		//person.version = xml.@version;
		
		// If the assertions list is present loop over them 
		for each (var xmlAssertion:XML in xml.person.assertions)
		{
			var assertionType:String = xmlAssertion.name();
			if (assertionType == Assertion.TYPE_NAME)
				person.nameAssertions.push(NameAssertion.parseXML(xmlAssertion));
			//else if (assertionType == Assertion.TYPE_GENDER)
			//	person.genderAssertions.push(GenderAssertion.parseXML(xmlAssertion));
		}
		
		var events:Array = new Array();
		// Create EventSummary list
		for each(var resultEvent:XML in xml.person.events.event)
		{
			events.push(EventSummary.parseXML(resultEvent));
		}
		person.events = new ArrayCollection(events);
		
		default xml namespace = new Namespace("");
		
    	return person;
    }
    
    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    //--------------------------------------------------------------------------
    //
    //  Variables
    //
    //--------------------------------------------------------------------------   

	/**
	 * 	Array of name assertions
	 */
	public var nameAssertions:Array = new Array();

	/**
	 * 	Array of gender assertions
	 */
	public var genderAssertions:Array = new Array();

	/**
	 * 	Array of event assertions
	 */
	public var eventAssertions:Array = new Array();

	/**
	 * 	Array of fact assertions
	 */
	public var factAssertions:Array = new Array();

	/**
	 * 	Array of ordinance assertions
	 */
	public var ordinanceAssertions:Array = new Array();

	/**
	 * 	Array of relationship assertions
	 */
	public var relationshipAssertions:Array = new Array();


    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------    
	
    //----------------------------------
    //  maxDeathYear
    //----------------------------------

    /**
     *  @private
     *  Storage for the maxDeathYear property.
     */
    private var _maxDeathYear:String = "";

    /**
     *  The maxDeathYear property
     *
     *  @default  = ""
     */
    public function get maxDeathYear():String
    {
        return _maxDeathYear;
    }

    /**
     *  @private
     */
    public function set maxDeathYear(value:String):void
    {
        _maxDeathYear = value;
    }


    //----------------------------------
    //  minBirthYear
    //----------------------------------

    /**
     *  @private
     *  Storage for the minBirthYear property.
     */
    private var _minBirthYear:String = "";

    /**
     *  The minBirthYear property
     *
     *  @default  = ""
     */
    public function get minBirthYear():String
    {
        return _minBirthYear;
    }

    /**
     *  @private
     */
    public function set minBirthYear(value:String):void
    {
        _minBirthYear = value;
    }


    //----------------------------------
    //  id
    //----------------------------------

    /**
     *  @private
     *  Storage for the id property.
     */
    private var _id:String = "";

    /**
     *  The id property
     *
     *  @default  = ""
     */
    public function get id():String
    {
        return _id;
    }

    /**
     *  @private
     */
    public function set id(value:String):void
    {
        _id = value;
    }


    //----------------------------------
    //  role
    //----------------------------------

    /**
     *  @private
     *  Storage for the role property.
     */
    private var _role:Role;

    /**
     *  The role property
     *
     *  @default 
     */
    public function get role():Role
    {
        return _role;
    }

    /**
     *  @private
     */
    public function set role(value:Role):void
    {
        _role = value;
    }

}
}
